package com.credit.jumu.calculator.utils;

import android.widget.Toast;

import com.credit.jumu.calculator.calculatorapp.CalculatorApp_;

public class ToastUtil {
	private static Toast toast;

	/**
	 * 可以连续弹吐司，不用等上个吐司消失
	 *
	 * @param text
	 */
	public static void showShortToast(String text) {
		try {
			if (null == CalculatorApp_.getInstance())
				return;
			if (toast == null) {
				toast = Toast.makeText(CalculatorApp_.getInstance(), text, Toast.LENGTH_SHORT);
			}
			toast.setText(text);
			toast.show();
		} catch (Exception ex) {

		}
	}

	public static void showLongToast(String text) {
		try {
			if (CalculatorApp_.getInstance() == null) return;
			Toast toast = null;
			if (toast == null) {
				toast = Toast.makeText(CalculatorApp_.getInstance(), text, Toast.LENGTH_LONG);
			}
			toast.setText(text);
			toast.show();
		} catch (Exception ex) {

		}
	}
}
